<?php
/*
 * @Author: your name
 * @Date: 2020-06-05 17:32:41
 * @LastEditTime: 2020-10-27 13:47:19
 * @LastEditors: your name
 * @Description: In User Settings Edit
 * @FilePath: /special/application/api/controller/ExportController.php
 */

namespace app\api\controller;

//导出
use think\Db;

class ExportController extends BaseController
{
    //初始化
    protected function initialize()
    {
        ignore_user_abort(true);
        set_time_limit(0);
        ini_set('memory_limit', '128M');
    }

    /**
     * @name Netfilter日志导出
     * @author wx
     * @date 2019/11/5 16:58
     */
    public function netfilterLog()
    {
        //接收参数
        $data['id'] = input('post.id');
        $data['module'] = input('post.module');
        $info = Db::name('server_download')->where($data)->where('status','in', [0,1])->find();
        if(!$info){
            echo '无相关任务';
            die;
        }

        $server = new \app\api\service\Export();
        $server->netfilterLog($info);
    }

    public function rule()
    {
        //接收参数
        $data['id'] = input('post.id');
        $data['module'] = input('post.module');

        $info = Db::name('server_download')->where($data)->where('status','in', [0,1])->find();

        if(!$info){
            echo '无相关任务';
            die;
        }

        $server = new \app\api\service\Export();
        $server->rule($info);
    }
}